build_program() {
  Program="$1"
  OS="$2"
  Arch="$3"

  export GOOS="$OS"
  export GOARCH="$Arch"

  Ext=""
  if [ "$OS" = "windows" ]; then
    Ext=".exe"
  fi

  cd "${RootDir}/src/cmd/${Program}"
  go fmt *.go

  Version=$(awk '/var Version =/{gsub("\"", "", $4); print $4}' version.go)
  TargetFile="${Program}_${OS}_${Arch}-${Version}${Ext}"

  echo "Building ${TargetFile}"
  go build -o "${RootDir}/bin/${TargetFile}" -ldflags "-s"
}
